package com.hyzh.latte.vehicle.dmo;

import com.coffee.core.CoffeeResponseEnum;
import com.coffee.core.ResponseCode;
import lombok.Getter;
import lombok.Setter;

/**
 * @author songkui
 * @since 2024/8/23 9:38
 */
@Getter
@Setter
public class LatteResponse<T> {
    private int state;
    private int code;
    private String message;
    private T data;

    public static <T> LatteResponse<T> response(ResponseCode responseCode) {
        return response(null, responseCode);
    }

    public static <T> LatteResponse<T> responseSuccess(T data) {
        return response(data, CoffeeResponseEnum.Success);
    }

    public static <T> LatteResponse<T> response(T data, ResponseCode responseCode) {
        return new LatteResponse<>(responseCode.code(),   responseCode.message(), data);
    }

    public static <T> LatteResponse<T> responseMessage(int state, String message) {
        return new LatteResponse<>(state,   message,  null);
    }
    public LatteResponse() {
    }

    public LatteResponse(int state,  String message, T data) {
        this.code = state;
        this.state = state;
        this.message = message;
        this.data = data;
    }


}
